home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / sound / fmsyn104.zip / STMB.H < prev    next >
C/C++ Source or Header  |  1993-06-21  |  5KB  |  116 lines

  1. /* STMB.H -- Programming interface for FMSYNTH.DRV
  2.  *           Copyright (c) 1993 by Jamie O'Connell
  3.  *
  4.  * Currently four functions are defined: GetTimbre, SetTimbre, GetPercMap,
  5.  * ans SetPercMap.
  6.  * 
  7.  * Get Timbre retrieves the Timbre parameters from the specified location.
  8.  *
  9.  * SetTimbre will change the sound of an instrument in either working 
  10.  * storage or the sound of an instrument stored within a RAM Timbre Bank.
  11.  * 
  12.  * GetPercMap and SetPercMap perform equivalent functions on the internal
  13.  * percussion map: which note plays which percussion timbre at what pitch.
  14.  *
  15.  * Working storage is the current version of a Timbre stored on a 
  16.  * per-channel basis.  It is the version of the timbre which is used to
  17.  * sound a voice for the channel when a note is to be played. The working 
  18.  * storage is overwritten by Bank storage whenever a program change is 
  19.  * received for the channel.
  20.  *
  21.  * The RAM Timbre bank is either the internal Timbre Bank, or one which 
  22.  * has been loaded from a file.  In either case it is volatile storage
  23.  * which is overwritten when the bank is reloaded.
  24.  */
  25.  
  26. #ifndef  __STMB_H
  27. #define  __STMB_H
  28.  
  29. #define TMB_WORKING_STORAGE      0
  30. #define TMB_BANK_STORAGE         1
  31. #define TMB_BANK_PERCUSSION      2
  32.  
  33. #define FIRSTDRUMNOTE  35
  34. #define LASTDRUMNOTE   81
  35. #define NUMDRUMNOTES   (LASTDRUMNOTE - FIRSTDRUMNOTE + 1)
  36.  
  37. // The timbre definition (IBK - SBI Format)
  38.  
  39. typedef struct _tagTIMBRE {
  40.         BYTE MSndChr;
  41.         BYTE CSndChr;
  42.         BYTE MKSLOut;
  43.         BYTE CKSLOut;
  44.         BYTE MAtkDcy;
  45.         BYTE CAtkDcy;
  46.         BYTE MSusRel;
  47.         BYTE CSusRel;
  48.         BYTE MWavSel;
  49.         BYTE CWavSel;
  50.         BYTE FDBkCon;
  51.         BYTE PercVoc;
  52.         CHAR Transpos;
  53.         BYTE Future[3];
  54.         } TIMBRE;
  55.         
  56. typedef TIMBRE FAR * LPTIMBRE;
  57.  
  58. typedef struct _tagPERCMAP {
  59.         BYTE patch;                 // the patch to use 
  60.         BYTE note;                  // the note to play  
  61.         } PERCMAP;
  62.  
  63. typedef PERCMAP FAR * LPPERCMAP;
  64.  
  65. // The percussion map provides info for each pecussion MIDI key   
  66. // To access (retrieve or send) the Percussion map you create an
  67. // array of these things: PERCMAP percMap[NUMDRUMNOTES]; 
  68. // and pass it to GetPercMap or SetPercMap.  The buffer must be at least
  69. // sizeof(PERCMAP) * NUMDRUMNOTES = 94 bytes large.
  70.  
  71. extern void FAR  PASCAL GetPercMap(LPPERCMAP lpPM);
  72. extern void FAR  PASCAL SetPercMap(LPPERCMAP lpPM);
  73.  
  74. extern WORD FAR  PASCAL GetTimbre(WORD wLoc, LPTIMBRE lpTmb, WORD wSrc);
  75. extern WORD FAR  PASCAL SetTimbre(WORD wLoc, LPTIMBRE lpTmb, WORD wDest);
  76.  
  77. /*   
  78.  *  DESCRIPTION
  79.  *
  80.  *  wLoc - If the Destination (wDest) or Source (wSrc) is TMB_WORKING_STORAGE,
  81.  *         then wLoc is the channel number (0 based) for storing the Timbre.  
  82.  *         If the Destination is TMB_BANK_STORAGE, then the most
  83.  *         significant byte of wLoc (HIBYTE(wLoc)) is the Bank number
  84.  *         (valid values: 0 - 4), and the least significant byte is the
  85.  *         timbre number (0-127).
  86.  *         If the destination is TMB_PERC_BANK, the Bank number is ignored
  87.  *         (there is only one percussion bank), and the LSB is the timbre
  88.  *         number (0-46).      
  89.  *
  90.  *  lpTmb  A far pointer to a TIMBRE structure, defining the new timbre to
  91.  *         store.  The structure should be the full 16 bytes in length.
  92.  *                                                                    
  93.  *  wSrc   This value determines how wLoc is interpreted when retrieving
  94.  *         the timbre.  If wSrc is TMB_WORKING_STORAGE the timbre is retrieved
  95.  *         from working storage (wLoc is a channel number). If wSrc is 
  96.  *         TMB_BANK_STORAGE, the timbre is retrieved from the specified
  97.  *         bank and timbre slot (wLoc is the combination of Bank & Timbre#).
  98.  *
  99.  *  wDest  This value determines how wLoc is interpreted and the final 
  100.  *         destination for the timbre.  If wDest is ST_WORKING_STORAGE the
  101.  *         channel timbre info is updated, and future voices on channel will
  102.  *         sound this timbre. If wDest is ST_BANK_STORAGE, both the Bank
  103.  *         Timbre, and any channels set to this Bank and Timbre are updated.
  104.  *         Any future notes playing this bank and timbre will sound the 
  105.  *         timbre.
  106.  *                                                             
  107.  *  Return Value
  108.  *         If all goes well, 0 is returned, otherwise a non-zero value is
  109.  *         returned indicating, an incorrect or out-of-range parameter.  
  110.  *         The values within the TIMBRE structure itself are not checked
  111.  *         for validity, but stored as supplied.
  112.  */
  113.    
  114.  
  115. #endif
  116.